package com.example.cloudcashierpos.dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.util.Log;

import org.greenrobot.greendao.AbstractDaoMaster;
import org.greenrobot.greendao.database.StandardDatabase;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseOpenHelper;
import org.greenrobot.greendao.identityscope.IdentityScopeType;


// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
 * Master of DAO (schema version 1): knows all DAOs.
 */
public class DaoMaster extends AbstractDaoMaster {
    public static final int SCHEMA_VERSION = 1;

    /** Creates underlying database table using DAOs. */
    public static void createAllTables(Database db, boolean ifNotExists) {
        GoodsDao.createTable(db, ifNotExists);
        UserDao.createTable(db, ifNotExists);
        corecmsdepartmentDao.createTable(db, ifNotExists);
        corecmsdiscountrulesDao.createTable(db, ifNotExists);
        corecmsexchangeDao.createTable(db, ifNotExists);
        corecmsfoodDao.createTable(db, ifNotExists);
        corecmsfoodcategoryDao.createTable(db, ifNotExists);
        corecmsfooddeskDao.createTable(db, ifNotExists);
        corecmsfooddeskcategoryDao.createTable(db, ifNotExists);
        corecmsfooddetailfeedDao.createTable(db, ifNotExists);
        corecmsfooddetailgroupDao.createTable(db, ifNotExists);
        corecmsfooddetailtaskDao.createTable(db, ifNotExists);
        corecmsfoodfeedDao.createTable(db, ifNotExists);
        corecmsfoodfeedcategoryDao.createTable(db, ifNotExists);
        corecmsfoodgradepriceDao.createTable(db, ifNotExists);
        corecmsfoodgroupdetailDao.createTable(db, ifNotExists);
        corecmsfoodorderclassDao.createTable(db, ifNotExists);
        corecmsfoodorderdetailDao.createTable(db, ifNotExists);
        corecmsfoodorderfeedDao.createTable(db, ifNotExists);
        corecmsfoodorderingDao.createTable(db, ifNotExists);
        corecmsfoodorderingfeedDao.createTable(db, ifNotExists);
        corecmsfoodorderingmasterDao.createTable(db, ifNotExists);
        corecmsfoodorderingtagDao.createTable(db, ifNotExists);
        corecmsfoodorderingtaskDao.createTable(db, ifNotExists);
        corecmsfoodordermasterDao.createTable(db, ifNotExists);
        corecmsfoodorderpaymentDao.createTable(db, ifNotExists);
        corecmsfoodordertagDao.createTable(db, ifNotExists);
        corecmsfoodordertaskDao.createTable(db, ifNotExists);
        corecmsfoodpackDao.createTable(db, ifNotExists);
        corecmsfoodpackdetailDao.createTable(db, ifNotExists);
        corecmsfoodprintschemeDao.createTable(db, ifNotExists);
        corecmsfoodsoldoutDao.createTable(db, ifNotExists);
        corecmsfoodspecDao.createTable(db, ifNotExists);
        corecmsfoodtagDao.createTable(db, ifNotExists);
        corecmsfoodtaskDao.createTable(db, ifNotExists);
        corecmsfoodtaskcategoryDao.createTable(db, ifNotExists);
        corecmsnumberdetailDao.createTable(db, ifNotExists);
        corecmspaymentsDao.createTable(db, ifNotExists);
        corecmsprintbilltemplateDao.createTable(db, ifNotExists);
        corecmsprintbilltypeDao.createTable(db, ifNotExists);
        corecmsprintdeskcategoryDao.createTable(db, ifNotExists);
        corecmsprintschemeDao.createTable(db, ifNotExists);
        corecmsprintschemedetailDao.createTable(db, ifNotExists);
        corecmsprinttaskdetailDao.createTable(db, ifNotExists);
        corecmsstoreDao.createTable(db, ifNotExists);
        corecmsstoremarketDao.createTable(db, ifNotExists);
        corecmsuserDao.createTable(db, ifNotExists);
        corecmsuserdepositrulesDao.createTable(db, ifNotExists);
        corecmsusergradeDao.createTable(db, ifNotExists);
        corecmsuserintegralrulesDao.createTable(db, ifNotExists);
        corecmsuserpointDao.createTable(db, ifNotExists);
        sysroleposDao.createTable(db, ifNotExists);
        sysuserDao.createTable(db, ifNotExists);
    }

    /** Drops underlying database table using DAOs. */
    public static void dropAllTables(Database db, boolean ifExists) {
        GoodsDao.dropTable(db, ifExists);
        UserDao.dropTable(db, ifExists);
        corecmsdepartmentDao.dropTable(db, ifExists);
        corecmsdiscountrulesDao.dropTable(db, ifExists);
        corecmsexchangeDao.dropTable(db, ifExists);
        corecmsfoodDao.dropTable(db, ifExists);
        corecmsfoodcategoryDao.dropTable(db, ifExists);
        corecmsfooddeskDao.dropTable(db, ifExists);
        corecmsfooddeskcategoryDao.dropTable(db, ifExists);
        corecmsfooddetailfeedDao.dropTable(db, ifExists);
        corecmsfooddetailgroupDao.dropTable(db, ifExists);
        corecmsfooddetailtaskDao.dropTable(db, ifExists);
        corecmsfoodfeedDao.dropTable(db, ifExists);
        corecmsfoodfeedcategoryDao.dropTable(db, ifExists);
        corecmsfoodgradepriceDao.dropTable(db, ifExists);
        corecmsfoodgroupdetailDao.dropTable(db, ifExists);
        corecmsfoodorderclassDao.dropTable(db, ifExists);
        corecmsfoodorderdetailDao.dropTable(db, ifExists);
        corecmsfoodorderfeedDao.dropTable(db, ifExists);
        corecmsfoodorderingDao.dropTable(db, ifExists);
        corecmsfoodorderingfeedDao.dropTable(db, ifExists);
        corecmsfoodorderingmasterDao.dropTable(db, ifExists);
        corecmsfoodorderingtagDao.dropTable(db, ifExists);
        corecmsfoodorderingtaskDao.dropTable(db, ifExists);
        corecmsfoodordermasterDao.dropTable(db, ifExists);
        corecmsfoodorderpaymentDao.dropTable(db, ifExists);
        corecmsfoodordertagDao.dropTable(db, ifExists);
        corecmsfoodordertaskDao.dropTable(db, ifExists);
        corecmsfoodpackDao.dropTable(db, ifExists);
        corecmsfoodpackdetailDao.dropTable(db, ifExists);
        corecmsfoodprintschemeDao.dropTable(db, ifExists);
        corecmsfoodsoldoutDao.dropTable(db, ifExists);
        corecmsfoodspecDao.dropTable(db, ifExists);
        corecmsfoodtagDao.dropTable(db, ifExists);
        corecmsfoodtaskDao.dropTable(db, ifExists);
        corecmsfoodtaskcategoryDao.dropTable(db, ifExists);
        corecmsnumberdetailDao.dropTable(db, ifExists);
        corecmspaymentsDao.dropTable(db, ifExists);
        corecmsprintbilltemplateDao.dropTable(db, ifExists);
        corecmsprintbilltypeDao.dropTable(db, ifExists);
        corecmsprintdeskcategoryDao.dropTable(db, ifExists);
        corecmsprintschemeDao.dropTable(db, ifExists);
        corecmsprintschemedetailDao.dropTable(db, ifExists);
        corecmsprinttaskdetailDao.dropTable(db, ifExists);
        corecmsstoreDao.dropTable(db, ifExists);
        corecmsstoremarketDao.dropTable(db, ifExists);
        corecmsuserDao.dropTable(db, ifExists);
        corecmsuserdepositrulesDao.dropTable(db, ifExists);
        corecmsusergradeDao.dropTable(db, ifExists);
        corecmsuserintegralrulesDao.dropTable(db, ifExists);
        corecmsuserpointDao.dropTable(db, ifExists);
        sysroleposDao.dropTable(db, ifExists);
        sysuserDao.dropTable(db, ifExists);
    }

    /**
     * WARNING: Drops all table on Upgrade! Use only during development.
     * Convenience method using a {@link DevOpenHelper}.
     */
    public static DaoSession newDevSession(Context context, String name) {
        Database db = new DevOpenHelper(context, name).getWritableDb();
        DaoMaster daoMaster = new DaoMaster(db);
        return daoMaster.newSession();
    }

    public DaoMaster(SQLiteDatabase db) {
        this(new StandardDatabase(db));
    }

    public DaoMaster(Database db) {
        super(db, SCHEMA_VERSION);
        registerDaoClass(GoodsDao.class);
        registerDaoClass(UserDao.class);
        registerDaoClass(corecmsdepartmentDao.class);
        registerDaoClass(corecmsdiscountrulesDao.class);
        registerDaoClass(corecmsexchangeDao.class);
        registerDaoClass(corecmsfoodDao.class);
        registerDaoClass(corecmsfoodcategoryDao.class);
        registerDaoClass(corecmsfooddeskDao.class);
        registerDaoClass(corecmsfooddeskcategoryDao.class);
        registerDaoClass(corecmsfooddetailfeedDao.class);
        registerDaoClass(corecmsfooddetailgroupDao.class);
        registerDaoClass(corecmsfooddetailtaskDao.class);
        registerDaoClass(corecmsfoodfeedDao.class);
        registerDaoClass(corecmsfoodfeedcategoryDao.class);
        registerDaoClass(corecmsfoodgradepriceDao.class);
        registerDaoClass(corecmsfoodgroupdetailDao.class);
        registerDaoClass(corecmsfoodorderclassDao.class);
        registerDaoClass(corecmsfoodorderdetailDao.class);
        registerDaoClass(corecmsfoodorderfeedDao.class);
        registerDaoClass(corecmsfoodorderingDao.class);
        registerDaoClass(corecmsfoodorderingfeedDao.class);
        registerDaoClass(corecmsfoodorderingmasterDao.class);
        registerDaoClass(corecmsfoodorderingtagDao.class);
        registerDaoClass(corecmsfoodorderingtaskDao.class);
        registerDaoClass(corecmsfoodordermasterDao.class);
        registerDaoClass(corecmsfoodorderpaymentDao.class);
        registerDaoClass(corecmsfoodordertagDao.class);
        registerDaoClass(corecmsfoodordertaskDao.class);
        registerDaoClass(corecmsfoodpackDao.class);
        registerDaoClass(corecmsfoodpackdetailDao.class);
        registerDaoClass(corecmsfoodprintschemeDao.class);
        registerDaoClass(corecmsfoodsoldoutDao.class);
        registerDaoClass(corecmsfoodspecDao.class);
        registerDaoClass(corecmsfoodtagDao.class);
        registerDaoClass(corecmsfoodtaskDao.class);
        registerDaoClass(corecmsfoodtaskcategoryDao.class);
        registerDaoClass(corecmsnumberdetailDao.class);
        registerDaoClass(corecmspaymentsDao.class);
        registerDaoClass(corecmsprintbilltemplateDao.class);
        registerDaoClass(corecmsprintbilltypeDao.class);
        registerDaoClass(corecmsprintdeskcategoryDao.class);
        registerDaoClass(corecmsprintschemeDao.class);
        registerDaoClass(corecmsprintschemedetailDao.class);
        registerDaoClass(corecmsprinttaskdetailDao.class);
        registerDaoClass(corecmsstoreDao.class);
        registerDaoClass(corecmsstoremarketDao.class);
        registerDaoClass(corecmsuserDao.class);
        registerDaoClass(corecmsuserdepositrulesDao.class);
        registerDaoClass(corecmsusergradeDao.class);
        registerDaoClass(corecmsuserintegralrulesDao.class);
        registerDaoClass(corecmsuserpointDao.class);
        registerDaoClass(sysroleposDao.class);
        registerDaoClass(sysuserDao.class);
    }

    public DaoSession newSession() {
        return new DaoSession(db, IdentityScopeType.Session, daoConfigMap);
    }

    public DaoSession newSession(IdentityScopeType type) {
        return new DaoSession(db, type, daoConfigMap);
    }

    /**
     * Calls {@link #createAllTables(Database, boolean)} in {@link #onCreate(Database)} -
     */
    public static abstract class OpenHelper extends DatabaseOpenHelper {
        public OpenHelper(Context context, String name) {
            super(context, name, SCHEMA_VERSION);
        }

        public OpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory, SCHEMA_VERSION);
        }

        @Override
        public void onCreate(Database db) {
            Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
            createAllTables(db, false);
        }
    }

    /** WARNING: Drops all table on Upgrade! Use only during development. */
    public static class DevOpenHelper extends OpenHelper {
        public DevOpenHelper(Context context, String name) {
            super(context, name);
        }

        public DevOpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory);
        }

        @Override
        public void onUpgrade(Database db, int oldVersion, int newVersion) {
            Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
            dropAllTables(db, true);
            onCreate(db);
        }
    }

}
